VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmDummy 
   Caption         =   "Dummy"
   ClientHeight    =   7035
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   14040
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   7035
   ScaleWidth      =   14040
   Begin VB.CommandButton cmdClose 
      Caption         =   "Close"
      Height          =   615
      Left            =   12960
      TabIndex        =   8
      Top             =   7440
      Width           =   5775
   End
   Begin VB.CommandButton cmdLogout 
      Caption         =   "Logout"
      Height          =   615
      Left            =   16800
      TabIndex        =   7
      Top             =   6120
      Width           =   1935
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Enabled         =   0   'False
      Height          =   615
      Left            =   12960
      TabIndex        =   6
      Top             =   6120
      Width           =   1935
   End
   Begin VB.TextBox txtDescription 
      Height          =   4455
      Left            =   12960
      MultiLine       =   -1  'True
      TabIndex        =   5
      Top             =   1320
      Width           =   5775
   End
   Begin VB.ComboBox comDevice 
      Height          =   315
      Left            =   14280
      TabIndex        =   2
      Text            =   "Select a device"
      Top             =   120
      Width           =   1815
   End
   Begin MSDataGridLib.DataGrid dgUserIncidences 
      Height          =   9135
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   12855
      _ExtentX        =   22675
      _ExtentY        =   16113
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.Label lblDescription 
      AutoSize        =   -1  'True
      Caption         =   "Description"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   12960
      TabIndex        =   4
      Top             =   720
      Width           =   1440
   End
   Begin VB.Label lblDeviceID 
      AutoSize        =   -1  'True
      Caption         =   "ID: "
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   16440
      TabIndex        =   3
      Top             =   120
      Width           =   450
   End
   Begin VB.Label lblDevice 
      AutoSize        =   -1  'True
      Caption         =   "Device"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   12960
      TabIndex        =   1
      Top             =   120
      Width           =   885
   End
End
Attribute VB_Name = "frmDummy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdClose_Click()
    End
End Sub

Private Sub cmdLogout_Click()
    Me.Hide
End Sub

Private Sub cmdOK_Click()
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs.Open ("insert into incidences (Description,Status,Severity,Priority,ID_Device,Dummy) values ('" & Me.txtDescription.Text & "','Opened','Normal',3," & Me.comDevice.ItemData(Me.comDevice.ListIndex) & ",'" & frmLogin.txtLogin.Text & "')")
    Me.txtDescription = ""
    MsgBox ("Incidence added")
End Sub

Private Sub comDevice_Click()
    Me.cmdOK.Enabled = True
    Me.lblDeviceID.Caption = "ID: " & Me.comDevice.ItemData(Me.comDevice.ListIndex)
End Sub

Private Sub Form_Load()
    Me.Caption = Me.Caption & " interface: Loged as " & frmLogin.txtLogin.Text
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim rs2 As New ADODB.Recordset
    Dim cont As Integer
    cont = 0
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs2.ActiveConnection = connector
    rs2.CursorType = adOpenDynamic
    rs2.CursorLocation = adUseClient
    rs2.LockType = adLockOptimistic
    rs.Open ("select * from incidences where dummy='" & frmLogin.txtLogin.Text & "'")
    Set Me.dgUserIncidences.DataSource = rs
    rs2.Open ("select ID_Device, Device from devices order by ID_Device")
    While Not rs2.EOF
        Me.comDevice.AddItem (rs2.Fields(1).Value)
        Me.comDevice.ItemData(cont) = rs2.Fields(0).Value
        cont = cont + 1
        rs2.MoveNext
    Wend
End Sub

